<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script src="Grid/GridE.js"> </script>
<body>
<input type="button" onclick="loadLocalXML()" value="load by Local XML">
<input type="button" onclick="loadXML()" value="load by XML">
<input type="button" onclick="loadJSON()" value="load by JSON">
	<div id="d2" style="width:100%;">
	<treegrid id="g1" Data_Url="MyData.xml" Layout_Url="MyDef.xml"> </treegrid>  
	</div>
	
<input type="button" onclick="saveAsXML()" value="save by XML">
<input type="button" onclick="saveAsJSON()" value="save by JSON">
	<hr>
	</body>
<script type="text/javascript">

function clearDefault(arg){
	//alert("clear");
	arg.value = "";
}
function loadLocalXML(){
	var grid1=Grids["g1"];
	grid1.Source.Data.Url ="MyData.xml";
	grid1.ReloadBody(); 
}
function loadXML(){
	var grid1=Grids["g1"];
	grid1.Source.Data.Url ="test?arg=xml";
	grid1.ReloadBody(); 
}

function loadJSON(){
	var grid1=Grids["g1"];
	grid1.Source.Layout.Url ="MyDef.xml";
	grid1.Source.Data.Url ="test?arg=json";
	grid1.ReloadBody(); 
}
function saveAsXML(){
	var grid1=Grids["g1"];
	grid1.Source.Upload.Url = "upload?arg=xml";
	grid1.Source.Upload.Type = "Data";
	grid1.Source.Upload.Xml = 1;
	grid1.Save(); 
}
function saveAsJSON(){
	var grid1=Grids["g1"];
	grid1.Source.Upload.Url ="upload?arg=json";
	grid1.Source.Upload.Type ="Data";
	grid1.Source.Upload.Format  ="JSON";
	grid1.Save(); 
}

</script>
</html>